package net.feixiang.creational.builder;

/**
 * 建造者模式示例
 *
 * @author 飞翔
 * @see <a href="https://www.feixiang.net/Java%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/%E7%AC%AC%E4%B8%80%E7%AB%A0%E3%80%81%E5%88%9B%E5%BB%BA%E5%9E%8B%E6%A8%A1%E5%BC%8F/14.html">建造者模式</a>
 */
public class BuilderDemo {
    public static void main(String[] args) {
        // 配置全参数的电脑
        Computer computer1 = new Computer.Builder()
                .cpu("Intel i7")
                .memory("16G")
                .disk("1T")
                .graphicsCard("NVIDIA")
                .build();
        System.out.println(computer1);

        // 配置部分参数的电脑
        Computer computer2 = new Computer.Builder()
                .cpu("AMD Ryzen 5")
                .memory("8G")
                .build();
        System.out.println(computer2);
    }
}